home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / dev / basic / PureBasic.lha / PureBasic_Demo / PureBasic / Examples / FullVersion_Sources / WaponezII.pb < prev    next >
Encoding:
Text File  |  2000-03-19  |  15.3 KB  |  737 lines

  1. ;
  2. ; **************
  3. ;               *
  4. ; Waponez II     **********************************************
  5. ;                                                              *
  6. ;   Origninal Waponez is from NC Gamez ! Check it on Aminet...  *
  7. ;                                                                *
  8. ; *****************************************************************
  9. ;
  10. ;
  11. ; Author note (AlphaSND):
  12. ; -----------------------
  13. ;
  14. ; This game was developped in a hurry (all the game was done in 6 days,
  15. ; working at spare time) so it's just a little example of what the
  16. ; PureBasic can do. This game requiers an AGA Amiga for the nice title
  17. ; screen, else the rest of the gfx are in standard 32 colours (work
  18. ; on all Amiga). 
  19. ;
  20. ; -----------------------------------------------------------------------
  21. ;
  22. ; History:
  23. ;
  24. ; 11/03/2000
  25. ;   + Added sound support !
  26. ;   + Draw a nice title picture...
  27. ;   + Use an AmigaSprite to hide the mouse pointer.
  28. ;   + Commented the code a lot
  29. ;
  30. ; 21/02/2000
  31. ;   + Added Pause & ESC key support :).
  32. ;
  33. ; 20/02/2000
  34. ;   + Added Mapped background... A special tool has been created
  35. ;     to create nice background with ease.
  36. ;   + Start/Stop the sprite server in the loop ensure a good multitask !
  37. ;     Very plaisant to see...
  38. ;   + Added some other aliens (the final boss ;*)
  39. ;   + Added a nice FadeOut routine at the end (easy, it's PB which do it).
  40. ;   + Added collisions between player & sprite.
  41. ;
  42. ; 19/02/2000
  43. ;   + Added real sprite support (still using linked list :*)...)
  44. ;   + Added animated sprite support
  45. ;   + Added lot of bullets... It works very well !! :)
  46. ;   + Added explosion & collision routines.. Need a good CPU now :*D.
  47. ;   + Perfectly smooth on a 1230/50.
  48. ;
  49. ; 18/02/2000
  50. ;   + Added the real gfx, it looks very nice :)
  51. ;   + Implemented the bullets via a linked list, the easier way...
  52. ;
  53. ; 15/02/2000
  54. ;   + Started the routine.
  55. ;   + Very nice looking 50 fps scroll in OS mode.
  56. ;   + Added the main sprite which moving around with joypad...
  57. ;   + Added the aliens :*). 
  58. ;   + Reworked the routine because a big bug (still same speed)
  59. ;
  60.  
  61. ; This game can be started from the Workbench.
  62. ;
  63. WbStartup()
  64.  
  65. ; Initialise all the libraries we're using in this game
  66. ;
  67. InitAmigaSprites(10)
  68. InitSprite(100,100,100)
  69. InitBitMap(2)
  70. InitScreen(2)
  71. InitJoypad()
  72. InitPalette(10)
  73. InitPicture(1)
  74. InitSound(10)
  75. *TagList = InitTagList(100)
  76.  
  77. ;
  78. ; Create and allocate all the necessary bitmaps:
  79. ; 2 for the double buffering routine;
  80. ; 1 for the title screen
  81. ;
  82. AllocateBitMap(0, 320, 480+64+20, 5)  ; 2 x ScreenHeight + 64 + 20 
  83. AllocateBitMap(1, 320, 480+64+20, 5)  ;
  84. AllocateBitMap(2, 320, 50, 8)         ; Title BitMap
  85.  
  86. ;
  87. ; Our own structures for each objects (bullets, aliens,...)
  88. ; It's very handy to use such structures because all the 
  89. ; informations relative to each objects (bullet, aliens,...)
  90. ; like the position, the speed... is stored in the
  91. ; same name. It's object oriented programming :*) (A bit... OOPs)
  92. ;
  93. Structure Bullet
  94.   x.w
  95.   y.w
  96.   Width.w
  97.   Height.w
  98.   Image.w
  99.   SpeedX.w
  100.   SpeedY.w
  101. EndStructure
  102.  
  103. NewList Bullet.Bullet()
  104.  
  105.  
  106. Structure Alien
  107.   x.w
  108.   y.w
  109.   Width.w
  110.   Height.w
  111.   Speed.w
  112.   StartImage.w
  113.   EndImage.w
  114.   ImageDelay.w
  115.   NextImageDelay.w
  116.   ActualImage.w
  117.   Armor.w
  118. EndStructure
  119.  
  120. NewList Aliens.Alien()
  121.  
  122.  
  123. Structure Explosion
  124.   x.w
  125.   y.w
  126.   State.w
  127.   Delay.w
  128. EndStructure
  129.  
  130. NewList Explosion.Explosion()
  131.  
  132.  
  133. ;
  134. ; Now we create the buffers to store the erased background
  135. ; information when we will display the sprites..
  136. ;
  137. UseBitMap(1)
  138. CreateSpriteBuffer(1, 10000, BitMapID())
  139. UseBitMap(0)
  140. CreateSpriteBuffer(0, 10000, BitMapID())
  141.  
  142. ; Our global 'Path$'. All files are relative to this path for easier localisation...
  143. ;
  144. Path$ = "PureBasic:Examples/WaponezII/"
  145.  
  146. LoadSprite(0, Path$+"Back_1")
  147. LoadSprite(1, Path$+"Player_1")
  148. LoadSprite(2, Path$+"Player_2")
  149. LoadSprite(3, Path$+"Player_3")
  150. LoadSprite(4, Path$+"Bullet_1")
  151. LoadSprite(5, Path$+"Back_2")
  152.  
  153. LoadSprite(6, Path$+"Bullet_Right")
  154. LoadSprite(7, Path$+"Bullet_Left")
  155. LoadSprite(8, Path$+"Bullet_Diag1")
  156. LoadSprite(9, Path$+"Bullet_Diag2")
  157.  
  158. LoadSprite(55, Path$+"Bullet_Bottom")
  159.  
  160. ;
  161. ; Sprite 10 to 5 reserved for the rotating animated alien..
  162. ;
  163.  
  164. For k=0 To 5
  165.   LoadSprite(k+10, Path$+"Ennemy_3_"+Str(k+1))
  166. Next
  167.  
  168. ;
  169. ; Sprite 20 to 30 reserved for the explosions...
  170. ;
  171.  
  172. For k=0 To 7
  173.   LoadSprite(k+20, Path$+"Explosion_"+Str(k+1))
  174. Next
  175.  
  176. ;
  177. ; Load all the background blocks...
  178. ;
  179.  
  180. For k=0 to 9
  181.   LoadSprite(k+30, Path$+"Back_"+Str(k+1))
  182. Next
  183.  
  184. LoadSprite(50, Path$+"Boss")
  185.  
  186. ;
  187. ; Load our blank AmigaSprite to hide pointer on the 2 screens
  188. ;
  189.  
  190. LoadAmigaSprite(0, Path$+"Blank")
  191.  
  192. ;
  193. ; Now, load our sounds..
  194. ;
  195.  
  196. SoundPath$ = Path$+"Sounds/"
  197.  
  198. LoadSound(0, SoundPath$+"Lazer")
  199. SetSoundChannels(0, 1)            ; Will be played only the 1st channel
  200. SetSoundVolume(0, 32)
  201.  
  202. LoadSound(1, SoundPath$+"Background")
  203. SetSoundChannels(1, 2)            ; ...only on the 2nd channel
  204.  
  205. LoadSound(2, SoundPath$+"Explosion")
  206. SetSoundChannels(2, 4)            ; ...only the 3nd channel
  207. SetSoundVolume(2, 48)
  208. SetSoundPeriod(2, 400)
  209.  
  210. ;
  211. ; Init all variables with will be used later
  212. ;
  213.  
  214. PlayerWidth  = SpriteWidth(1)
  215. PlayerHeight = SpriteHeight(1)
  216.  
  217. ;
  218. ; Load the needed palette and the title picture (and its palette)
  219. ;
  220. LoadPalette(0, Path$+"Back_1")
  221.  
  222. LoadPicture(0, Path$+"Title_256.iff")  ; Whow a 256 colour picture ?
  223. GetPicturePalette(4, PictureID())      ;
  224.  
  225. UseBitMap(2)                      ; Render the picture on the BitMap
  226. PictureToBitMap(0, BitMapID())    ;
  227.  
  228. ; Very important: change the program priority to 20, as we need lot
  229. ; of cpu time..
  230. ProgramPriority(20) 
  231.  
  232. ResetTagList(#SA_Type, #CUSTOMSCREEN | #CUSTOMBITMAP)
  233.       AddTag(#SA_Quiet, 1)
  234.       AddTag(#SA_BitMap, BitMapID())
  235. If OpenScreen(1, 320, 25, 8, *TagList) = 0
  236.   End
  237. EndIf
  238.  
  239. DisplayPalette(4,ScreenID())
  240.  
  241. UseBitMap(0)
  242. ResetTagList(#SA_Type, #CUSTOMSCREEN | #CUSTOMBITMAP)
  243.       AddTag(#SA_Quiet,1)
  244.       AddTag(#SA_BitMap, BitMapID())
  245.       AddTag(#SA_Top, 28)
  246.       AddTag(#SA_Parent, ScreenID())
  247.       AddTag(#SA_Draggable, 0)
  248. If OpenScreen(0,320,240,5, *TagList)
  249.  
  250.   DisplayPalette(0, ScreenID())
  251.  
  252.   AmigaSpriteScreen(ScreenID())  ; AmigaSprite will be displayed on this screen
  253.  
  254.   AllocateSoundChannels(15) ; All Channels are reserved for Waponez II
  255.  
  256.   PlayerSpeed = 2      ; The speed of our player !
  257.  
  258.   db = 1
  259.    b = 0
  260.  
  261.   ScrollY.w = 240+32+16
  262.  
  263.   AdditionnalBlock = 8
  264.   BackgroundLine   = 0
  265.  
  266.   *Level1 = ?Level1
  267.  
  268.   PlaySound(1,-1)
  269.  
  270.   Repeat
  271.     VWait()
  272.  
  273.     DisplayAmigaSprite(0, 0, 321, 241)    ; remove the mouse pointer ! (Sprite 0 on Channel 0 at position 321, 241)
  274.    
  275.     ShowBitMap(db, ScreenID(), 0, ScrollY) ; Here is the double buffering tips
  276.                                            ; 'db' is alternately 0 and 1 so the bitmaps 0 and 1
  277.                                            ; are displayed one after other. When a bitmap is
  278.                                            ; displayed we do the work on the other bitmap.
  279.  
  280.     StartSpriteServer()    ; Start the sprite server !
  281.  
  282.     Gosub CheckPause
  283.  
  284.     If BackgroundLine < 15*4
  285.       ScrollY-1
  286.  
  287.       If ScrollY<16
  288.         ScrollY = 240+31+16
  289.       EndIf
  290.     Else
  291.       If Boss = 0
  292.         AlienDelay = 100
  293.       EndIf
  294.  
  295.       Boss = 1
  296.     EndIf
  297.  
  298.     db = 1-db
  299.     
  300.     UseSpriteBuffer(db)
  301.     
  302.     ResetSpriteServer()
  303.     RestoreBackGround()
  304.     
  305.     If BackgroundLine < 15*4
  306.     
  307.     BlockY = ScrollY & $FFF0 - 16   ; Little tip to have 16 boundary aligned Y coords..
  308.     
  309.     BlockID1 = PeekB(*Level1)+30     ; Read which blocks should be displayed on the background..
  310.     BlockID2 = PeekB(*Level1+1)+30   ;
  311.     
  312.     AddBlockSprite(BlockID1, BlockX   , BlockY)
  313.     AddBlockSprite(BlockID2, BlockX+16, BlockY)
  314.     AddBlockSprite(BlockID1, BlockX   , BlockY+240+32)
  315.     AddBlockSprite(BlockID2, BlockX+16, BlockY+240+32)
  316.     
  317.     If AdditionnalBlock
  318.       BlockID3 = PeekB(*Level1+2)+30
  319.     
  320.       AddBlockSprite(BlockID3, BlockX+32, BlockY)
  321.       AddBlockSprite(BlockID3, BlockX+32, BlockY+240+32)
  322.     
  323.       AdditionnalBlock-1
  324.       If db = 1
  325.         BlockX+16
  326.         *Level1+1
  327.       EndIf
  328.     EndIf
  329.  
  330.     If db = 1
  331.       BlockX+32
  332.       *Level1+2
  333.     EndIf
  334.  
  335.     If BlockX >= 320
  336.       BlockX = 0
  337.       AdditionnalBlock = 8
  338.       BackgroundLine+1
  339.     Endif
  340.  
  341.     EndIf
  342.  
  343.     UseSpriteBuffer(db)  ; Restore original buffer...
  344.  
  345.     Gosub CheckCollisions
  346.  
  347.     Gosub MovePlayers
  348.     
  349.     Gosub DisplayBullets
  350.     
  351.     Gosub NewAlienWave
  352.     
  353.     Gosub DisplayAliens
  354.     
  355.     Gosub DisplayExplosions
  356.  
  357.     If BulletDelay > 0
  358.       BulletDelay-1
  359.     EndIf
  360.      
  361.     WaitSpriteServer()
  362.     StopSpriteServer()
  363.   Until Quit = 1 OR PressedRawKey() = 69
  364.  
  365.   Gosub EndGame
  366.  
  367. EndIf
  368.  
  369. End
  370.  
  371.                                            
  372. MovePlayers:
  373.  
  374.   Select JoypadMovement(1)
  375.     Case 1
  376.       PlayerY - PlayerSpeed
  377.       PlayerImage = 1
  378.  
  379.     Case 2
  380.       PlayerY - PlayerSpeed
  381.       PlayerX + PlayerSpeed
  382.       PlayerImage = 2
  383.  
  384.     Case 3
  385.       PlayerX + PlayerSpeed
  386.       PlayerImage = 2
  387.  
  388.     Case 4
  389.       PlayerX + PlayerSpeed
  390.       PlayerY + PlayerSpeed
  391.       PlayerImage = 2
  392.  
  393.     Case 5
  394.       PlayerY + PlayerSpeed
  395.       PlayerImage = 1
  396.    
  397.     Case 6
  398.       PlayerY + PlayerSpeed
  399.       PlayerX - PlayerSpeed
  400.       PlayerImage = 3
  401.  
  402.     Case 7
  403.       PlayerX - PlayerSpeed
  404.       PlayerImage = 3
  405.     
  406.     Case 8
  407.       PlayerX - PlayerSpeed
  408.       PlayerY - PlayerSpeed
  409.       PlayerImage = 3
  410.  
  411.     Default
  412.       PlayerImage = 1
  413.  
  414.   EndSelect
  415.  
  416.   If PlayerX < 0 : PlayerX = 0 : EndIf
  417.   If PlayerY < 0 : PlayerY = 0 : EndIf
  418.  
  419.   If PlayerX > 320-PlayerWidth  : PlayerX = 320-PlayerWidth : EndIf
  420.   If PlayerY > 240-PlayerHeight : PlayerY = 240-PlayerHeight : EndIf
  421.  
  422.  
  423.   If Dead = 1 
  424.     AddElement(Explosion())
  425.     Explosion()\x = PlayerX
  426.     Explosion()\y = PlayerY
  427.  
  428.     Dead = 0
  429.   Else
  430.     If DeadDelay>0 
  431.       DeadDelay-1
  432.       If db=1 And DeadDelay < 100
  433.         AddBufferedSprite(PlayerImage, PlayerX, PlayerY+ScrollY)
  434.       EndIf
  435.     Else
  436.       AddBufferedSprite(PlayerImage, PlayerX, PlayerY+ScrollY)
  437.     EndIf
  438.   EndIf
  439.  
  440.   PressedButtons.l = JoypadButtons(1)
  441.   
  442.   
  443.   If PressedButtons & #PB_JOYPAD_BUTTON1
  444.     If BulletDelay = 0 And DeadDelay < 100
  445.     AddElement(Bullet())
  446.     Bullet()\x     = PlayerX+5
  447.     Bullet()\y     = PlayerY-10
  448.     Bullet()\Width = SpriteWidth(4)
  449.     Bullet()\Height= SpriteHeight(4)
  450.     Bullet()\Image = 4
  451.     Bullet()\SpeedY = -7
  452.     BulletDelay = 10
  453.  
  454.     AddElement(Bullet())
  455.     Bullet()\x = PlayerX+26
  456.     Bullet()\y = PlayerY+6
  457.     Bullet()\Width = SpriteWidth(6)
  458.     Bullet()\Height= SpriteHeight(6)
  459.     Bullet()\Image = 6
  460.     Bullet()\SpeedX = 7  
  461.  
  462.     AddElement(Bullet())
  463.     Bullet()\x = PlayerX-11
  464.     Bullet()\y = PlayerY+6
  465.     Bullet()\Width = SpriteWidth(7)
  466.     Bullet()\Height= SpriteHeight(7)
  467.     Bullet()\Image = 7
  468.     Bullet()\SpeedX = -7
  469.  
  470.     AddElement(Bullet())
  471.     Bullet()\x = PlayerX+26
  472.     Bullet()\y = PlayerY-6
  473.     Bullet()\Width = SpriteWidth(8)
  474.     Bullet()\Height= SpriteHeight(8)
  475.     Bullet()\Image = 8
  476.     Bullet()\SpeedX = 7
  477.     Bullet()\SpeedY = -7
  478.  
  479.     AddElement(Bullet())
  480.     Bullet()\x = PlayerX-11
  481.     Bullet()\y = PlayerY-6
  482.     Bullet()\Width = SpriteWidth(9)
  483.     Bullet()\Height= SpriteHeight(9)
  484.     Bullet()\Image = 9
  485.     Bullet()\SpeedX = -7
  486.     Bullet()\SpeedY = -7
  487.  
  488.     AddElement(Bullet())
  489.     Bullet()\x = PlayerX+12
  490.     Bullet()\y = PlayerY+32
  491.     Bullet()\Width = SpriteWidth(55)
  492.     Bullet()\Height= SpriteHeight(55)
  493.     Bullet()\Image = 55
  494.     Bullet()\SpeedY = 7
  495.  
  496.     PlaySound(0,1)
  497.  
  498.     EndIf
  499.   EndIf
  500.  
  501.   P2.l = JoypadButtons(0)
  502.  
  503.   If P2 & #PB_JOYPAD_BUTTON2
  504.     Quit = 1
  505.   EndIf
  506.  
  507. Return
  508.  
  509.  
  510. NewAlienWave:
  511.  
  512.   If AlienDelay = 0
  513.  
  514.     AddElement(Aliens())
  515.  
  516.     If Boss = 1
  517.       Aliens()\x = 100
  518.       Aliens()\y = -16
  519.       Aliens()\Width  = SpriteWidth(50)
  520.       Aliens()\Height = SpriteHeight(50)
  521.       Aliens()\Speed  = 2
  522.       Aliens()\StartImage = 50
  523.       Aliens()\EndImage = 50
  524.       Aliens()\ImageDelay = 1
  525.       Aliens()\NextImageDelay = 1
  526.       Aliens()\ActualImage = 50
  527.       Aliens()\Armor = 20
  528.    
  529.       AlienDelay = 80
  530.  
  531.     Else
  532.  
  533.     Aliens()\x = 100
  534.     Aliens()\y = -16
  535.     Aliens()\Width  = SpriteWidth(10) 
  536.     Aliens()\Height = SpriteHeight(10)
  537.     Aliens()\Speed = 2
  538.     Aliens()\StartImage  = 10 
  539.     Aliens()\EndImage    = 15 
  540.     Aliens()\ImageDelay  =  4
  541.     Aliens()\NextImageDelay = Aliens()\ImageDelay
  542.     Aliens()\ActualImage = 10
  543.     Aliens()\Armor = 4
  544.  
  545.     AlienDelay = 22
  546.  
  547.     Endif
  548.   Else
  549.     AlienDelay - 1
  550.   EndIf
  551.  
  552. Return
  553.  
  554.  
  555. DisplayAliens:
  556.  
  557.   ResetList(Aliens())
  558.   While NextElement(Aliens())
  559.  
  560.     AddBufferedSprite(Aliens()\ActualImage, Aliens()\x, Aliens()\y+ScrollY)
  561.  
  562.     Aliens()\y + Aliens()\Speed
  563.  
  564.     If Aliens()\NextImageDelay = 0
  565.  
  566.       Aliens()\ActualImage+1
  567.  
  568.       If Aliens()\ActualImage > Aliens()\EndImage
  569.         Aliens()\ActualImage = Aliens()\StartImage
  570.       EndIf
  571.  
  572.       Aliens()\NextImageDelay = Aliens()\ImageDelay
  573.     Else
  574.       Aliens()\NextImageDelay-1
  575.     EndIf
  576.  
  577.     If Aliens()\Armor <= 0 Or Aliens()\y > 240+16
  578.       If Aliens()\Armor <= 0
  579.  
  580.         AddElement(Explosion())
  581.         Explosion()\x = Aliens()\x
  582.         Explosion()\y = Aliens()\y
  583.  
  584.         Score+20
  585.       EndIf
  586.  
  587.       KillElement(Aliens())
  588.     EndIf
  589.   Wend
  590. Return
  591.  
  592.  
  593. DisplayBullets:
  594.  
  595.   ResetList(Bullet())
  596.   While NextElement(Bullet())
  597.  
  598.     If Bullet()\y < 0
  599.       KillElement(Bullet())
  600.     Else
  601.       If Bullet()\x < 0
  602.         KillElement(Bullet())
  603.       Else
  604.  
  605.         If Bullet()\x > 320-Bullet()\Width
  606.           KillElement(Bullet())
  607.         Else
  608.           If Bullet()\y > 245
  609.             KillElement(Bullet())
  610.           Else
  611.             AddBufferedSprite(Bullet()\Image, Bullet()\x, Bullet()\y+ScrollY)
  612.  
  613.             Bullet()\y + Bullet()\SpeedY
  614.             Bullet()\x + Bullet()\SpeedX
  615.           Endif
  616.         EndIf
  617.       EndIf
  618.     EndIf
  619.  
  620.   Wend
  621.  
  622. Return
  623.  
  624. ;
  625. ; This routine is very CPU intensive when many bullets are flying
  626. ; all around the screen...
  627. ;
  628. CheckCollisions:
  629.  
  630.   ResetList(Aliens())
  631.   While NextElement(Aliens())
  632.     ResetList(Bullet())
  633.     While NextElement(Bullet())
  634.  
  635.       If Bullet()\y <= Aliens()\y+Aliens()\Height
  636.         If Bullet()\y+Bullet()\Height >= Aliens()\y
  637.           If Bullet()\x+Bullet()\Width => Aliens()\x
  638.             If Bullet()\x <= Aliens()\x+Aliens()\Width
  639.               Aliens()\Armor-1
  640.               KillElement(Bullet())
  641.             EndIf
  642.           EndIf
  643.         EndIf
  644.       EndIf
  645.     Wend
  646.  
  647.     If DeadDelay = 0
  648.     If PlayerX+PlayerWidth > Aliens()\x
  649.       If PlayerX < Aliens()\x+Aliens()\Width
  650.         If PlayerY+PlayerHeight > Aliens()\y
  651.           If PlayerY < Aliens()\y+Aliens()\Height
  652.             Dead = 1
  653.             DeadDelay = 180 
  654.  
  655.             AddElement(Explosion())
  656.             Explosion()\x = Aliens()\x
  657.             Explosion()\y = Aliens()\y
  658.  
  659.             KillElement(Aliens())
  660.           EndIf
  661.         EndIf
  662.       EndIf
  663.     EndIf
  664.     EndIf
  665.   Wend
  666.  
  667. Return
  668.  
  669.  
  670. DisplayExplosions:
  671.  
  672.   ResetList(Explosion())
  673.   While NextElement(Explosion())
  674.  
  675.     AddBufferedSprite(Explosion()\State+20, Explosion()\x, Explosion()\y+ScrollY)
  676.  
  677.     If Explosion()\Delay = 0
  678.       If Explosion()\State = 0
  679.         PlaySound(2,1) 
  680.       EndIf
  681.  
  682.       If Explosion()\State < 7
  683.         Explosion()\State+1
  684.         Explosion()\Delay = 2
  685.       Else
  686.         KillElement(Explosion())
  687.       Endif
  688.     Else
  689.       Explosion()\Delay-1
  690.     EndIf
  691.   Wend
  692.  
  693. Return
  694.  
  695.  
  696. CheckPause:
  697.  
  698.   If PressedRawKey() = 25
  699.  
  700.     WaitSpriteServer()
  701.     StopSpriteServer()
  702.  
  703.     StopSound(0)
  704.  
  705.     Repeat
  706.       VWait()
  707.     Until PressedRawKey() <> 25
  708.  
  709.     Repeat
  710.       VWait()
  711.     Until PressedRawKey() = 25
  712.  
  713.     Repeat
  714.       VWait()
  715.     Until PressedRawKey() <> 25
  716.  
  717.     PlaySound(1,-1)
  718.  
  719.     StartSpriteServer()
  720.  
  721.   EndIf
  722. Return
  723.  
  724.  
  725. EndGame:
  726.  
  727.   FadeOut(0, ScreenID(), 4, 64)
  728.  
  729.   HideScreen()
  730.  
  731. Return
  732.  
  733.  
  734. Level1:
  735. IncludeBinary "PureBasic:Examples/WaponezII/DefaultMap"
  736.